<template>
	<view style="height: 100%;">
		<swiper :indicator-dots="false" :autoplay="false" :interval="3000" :duration="1000" :vertical="false"
			:circular="true" style="background-color: aquamarine;height: 150px; " :current="2" @change="swiperChange">
			<swiper-item v-for="item,index in list">
				<view class="swiper-item" style="width: 100%; height: 100%;">
					<image :src="item" mode="" style="width: 100%; height: 100%;"></image>
				</view>
			</swiper-item>
		</swiper>
		<uni-grid :column="4" @click="gridChange">
			<uni-grid-item :index="index" v-for="(item,index) in typelist" >
				<view class="grid-item">
					<image :src="'../../static'+item.icon" mode="" style="width: 70px;height: 70px;"></image>
					<text>{{item.typename}}</text>
				</view>
			</uni-grid-item>
			
		</uni-grid>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"typelist": [{
										"id": 1,
										"typename": "鱼类",
										"icon": "/images/fish.png"
									},
									{
										"id": 2,
										"typename": "肉类",
										"icon": "/images/meat.png"
									},
									{
										"id": 3,
										"typename": "菌菇类",
										"icon": "/images/mashroom.png"
									},
									{
										"id": 4,
										"typename": "豆制品",
										"icon": "/images/bean.png"
									},
									{
										"id": 5,
										"typename": "蔬菜",
										"icon": "/images/vegitable.png"
									},
									{
										"id": 6,
										"typename": "酒水",
										"icon": "/images/drink.png"
									},
									{
										"id": 7,
										"typename": "火锅",
										"icon": "/images/hotpot.png"
									},
									
									{
										"id": 8,
										"typename": "水果",
										"icon": "/images/fruit.png"
									}
				],
				list: ['../../static/cat-12.png', '../../static/logo.png', '../../static/logo.png']
			}
		},
		onLoad() {

		},
		methods: {

			swiperChange(e) {
				console.log('===', e);
			},
			gridChange(e){
				console.log("====",e);
			}
		}
	}
</script>

<style>
	page {
		height: 100%;
	}
	.grid-item{
		/* //让内容上下排列,中部居中 */
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>